<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<jsp:include page="global.jsp"></jsp:include>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>编辑项目详情</title>
<style type="text/css">
.ctl{
	text-decoration: none;
	color: blue;
	margin: auto 7px;
}
.ctl:HOVER{
	text-decoration: underline;
}
.center{
	text-align: center;
}
</style>
</head>
<body>
	<div class="easyui-tabs" style="width: 100%; height: 540px;">
		
		<div title="项目节点" style="padding: 2px;">
			<table id="projectMilestonedg" class="easyui-datagrid" title="项目节点管理"
					data-options="
						rownumbers:true,
						iconCls: 'icon-edit',
						singleSelect: true,
						toolbar: '#projectMilestonetb',
						singleSelect:true,
						pagination:true,
						fit:true,
						fitColumns:true,
						pageList:[20,25,30,35,40,45,50],
						pageSize:20
					">
				<thead>
					<tr>
						<th data-options="field:'name',width:80,align:'center'">节点名称</th>
						<th data-options="field:'firstPlanFinishDate',width:80,align:'center'">初次计划完成日期</th>
						<th data-options="field:'planFinishDate',width:100,align:'center'">计划完成日期</th>						
						<th data-options="field:'actualFinishDate',width:100,align:'center'">实际完成时间</th>						
						<th data-options="field:'status',width:60,align:'center'">状态</th>
						<th data-options="field:'id',width:60,align:'center',formatter:projectMilestoneFormatControl">管理</th>
					</tr>
				</thead>
			</table>
		
			<div id="projectMilestonetb" style="height:auto">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="clearForm('projectMilestoneForm', 'addProjectMilestoneItem');$('#addProjectMilestonePlanReviseCount').val('0');$('#addProjectMilestoneProjectId').val(${project.id});$('#addProjectMilestoneStatus').val('0001');">新增</a>
				</div>
				<div>
					质量监测录入人:
					<select data-options="editable: false" id = "qualityCheckPerson" class="easyui-combobox">
						<option value = "-1"> --全部-- </option>
						<c:forEach var="item" items="${qualityCheckPersons }" >
							<option value = "${item.id }">${item.name }</option>
						</c:forEach>
					</select>
					项目节点名称: <input class="easyui-textbox" type="text" id="projectMilestoneName" style="width:240px;height:25px;">
					<a href="javascript:projectMilestoneSearch()" class="easyui-linkbutton" iconCls="icon-search">查 找</a>
				</div>
			</div>
			
			<div id="lookProjectMilestoneDetail" class="easyui-window" title="项目节点详情" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:770px; height:550px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<table width="100%" height="100%">
							<tr>
								<td align="right">节点名称：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="required:true" style="width: 545px;"  readonly="readonly" id="lookProjectMilestoneName">
								</td>
							</tr>
							<tr>
								<td align="right">成果物及形式：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="multiline:true" style="width: 545px; height: 80px;"  readonly="readonly" id="lookProjectMilestoneDeliveryDescription">
								</td>
							</tr>
							<tr>
								<td align="right">计划完成日期：</td>
								<td>
									<input class="easyui-datebox" readonly="readonly" id="lookProjectMilestoneFirstPlanFinishDate" style="width: 200px;" />
								</td>
								<td align="right">计划完成时间：</td>
								<td>
									<input class="easyui-datebox"  readonly="readonly" id="lookProjectMilestonePlanFinishDate" style="width: 200px;" />
								</td>
							</tr>
							<tr>
								<td align="right">实际完成日期：</td>
								<td>
									<input class="easyui-datebox"  readonly="readonly" id="lookProjectMilestoneActualFinishDate" style="width: 200px;" />
								</td>
								<td align="right">计划调整次数：</td>
								<td>
									<input id="lookProjectMilestonePlanReviseCount" class="easyui-textbox" readonly="readonly" style="width: 200px;" >
								</td>
							</tr>
							<tr>
								<td align="right">质量检测人：</td>
								<td>
									<input id="lookProjectMilestoneQualityCheckPersonId" class="easyui-textbox" readonly="readonly" style="width: 200px;" >
								</td>
								<td width="130px;" align="right">状态：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMilestoneStatus" readonly="readonly" >
								</td>
							</tr>
							<tr>
								<td align="right">质量检测日期：</td>
								<td>
									<input class="easyui-datebox" readonly="readonly" id="lookProjectMilestoneQualityCheckDate" style="width: 200px;" />
								</td>
								<td align="right">质量检测点标志：</td>
								<td>
									<input class="easyui-textbox" readonly="readonly" id="lookProjectMilestoneQualityCheckSign" style="width: 200px;" />
								</td>
							</tr>
							<tr>
								<td align="right">质量检测录入日期：</td>
								<td>
									<input class="easyui-datebox" readonly="readonly" id="lookProjectMilestoneQualityCheckInputTime" style="width: 200px;" />
								</td>
								<td align="right">质量检测状态：</td>
								<td>
									<input class="easyui-textbox" readonly="readonly" id="lookProjectMilestoneQualityCheckStatus" style="width: 200px;" />
								</td>
							</tr>
							<tr>
								<td align="right">质量检测说明：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="multiline:true" style="width: 545px; height: 80px;" readonly="readonly" id="lookProjectMilestoneQualityCheckDescription">
								</td>
							</tr>
							<tr>
								<td align="right">备注：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="multiline:true" style="width: 545px; height: 80px;" readonly="readonly" id="lookProjectMilestoneRemark">
								</td>
							</tr>
						</table>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#lookProjectMilestoneDetail').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="addProjectMilestoneItem" class="easyui-window" title="新增项目节点" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:700px; height:400px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="projectMilestoneForm" method="post" action="editProjectMilestone" style = "width:100%; height: 100%">
							<input type="hidden" name="planReviseCount" value="0" id="addProjectMilestonePlanReviseCount" />
							<input type="hidden" name="project.id" value="${project.id }" id="addProjectMilestoneProjectId" />
							<input type="hidden" name="status" value="0001" id="addProjectMilestoneStatus" />
							<table width="100%" height="100%">
								<tr>
									<td width="130px;" align="right">节点名称：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="required:true" data-options="required:true" style="width: 540px;" name="name">
									</td>
								</tr>
								<tr>
									<td align="right" style="width: 150px;" >计划完成日期：</td>
									<td>
										<input class="easyui-datebox" name="firstPlanFinishDate" style="width: 200px;" data-options="required:true" />
									</td>
									<td align="right" style="width: 150px;" >质量控制点标志：</td>
									<td>
										<select  class="easyui-combobox" name="qualityCheckSign" style="width: 60px;" data-options="required:true, editable: false">
											<option value="Y">是</option>
											<option value="N">否</option>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">成果物及形式：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 540px; height: 80px;" name="deliveryDescription">
									</td>
								</tr>
								<tr>
									<td align="right">备注：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 540px; height: 80px;" name="remark">
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#projectMilestoneForm').submit()" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addProjectMilestoneItem').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="editProjectMilestoneItem" class="easyui-window" title="编辑项目节点" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:700px; height:400px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="editProjectMilestoneForm" method="post" action="editProjectMilestone" style = "width:100%; height: 100%">
							<input type="hidden" id="editProjectMilestoneId" name = "id">
							<input type="hidden" id="editPlanReviseCount" name="planReviseCount" />
							<input type="hidden" name="project.id" value="${project.id }" />
							<input type="hidden" name="status" value="0001" />
							<table width="100%" height="100%">
								<tr>
									<td align="right">节点名称：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="required:true" data-options="required:true" style="width: 540px;" name="name" id="editProjectMilestoneName">
									</td>
								</tr>
								<tr>
									<td align="right">计划完成日期：</td>
									<td>
										<input class="easyui-datebox" name="firstPlanFinishDate" id="editProjectMilestoneFirstPlanFinishDate" style="width: 200px;" data-options="required:true" />
									</td>
									<td align="right" style="width: 150px;" >质量控制点标志：</td>
									<td>
										<select  class="easyui-combobox" name="qualityCheckSign" id="editProjectMilestoneQualityCheckSign" style="width: 60px;" data-options="required:true, editable: false">
											<option value="Y">是</option>
											<option value="N">否</option>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">成果物及形式：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 540px; height: 80px;" name="deliveryDescription" id="editProjectMilestoneDeliveryDescription" />
									</td>
								</tr>
								<tr>
									<td align="right">备注：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 540px; height: 80px;" name="remark" id="editProjectMilestoneRemark">
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#editProjectMilestoneForm').submit()" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#editProjectMilestoneItem').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			<script type="text/javascript">
			/***********************************编辑节点****************************************************/
				function projectMilestoneFormatControl(val, row){
					var content = '<a class="ctl" href="javascript:void(0)" onclick="lookProjectMilestoneDetail(' + row.id + ')">查看</a>'
					content += ' <a class="ctl" href="javascript:void(0)" onclick="editProjectMilestoneItem(' + val + ')">编辑</a>';
					if(row.statusCode == '0001'){
						content += ' <a class="ctl" href="javascript:void(0)" onclick="delProjectMilestoneItem(' + val + ')">删除</a>';
					}
					return content;
				}
				function projectMilestoneSearch(){
					var name = $("#projectMilestoneName").textbox("getValue");
					var qualityCheckPerson = $("#qualityCheckPerson").combobox("getValue");
					var url = "queryProjectMilestone?name=" + name + "&sort=id&order=asc&projectId=${project.id}&qualityCheckPersonId=" + qualityCheckPerson;
					$("#projectMilestonedg").datagrid('reload', url);
				}
				function lookProjectMilestoneDetail(id){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectMilestone",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								$("#lookProjectMilestonePlanReviseCount").textbox("setValue", item.planReviseCount);
								$("#lookProjectMilestoneQualityCheckPersonId").textbox("setValue", item.qualityCheckPersonName);
								$("#lookProjectMilestoneName").textbox("setValue", item.name);
								$("#lookProjectMilestoneDeliveryDescription").textbox("setValue", item.deliveryDescription);
								$("#lookProjectMilestoneFirstPlanFinishDate").textbox("setValue", item.firstPlanFinishDate);
								$("#lookProjectMilestonePlanFinishDate").textbox("setValue", item.planFinishDate);
								$("#lookProjectMilestoneActualFinishDate").textbox("setValue", item.actualFinishDate);
								$("#lookProjectMilestoneAualityCheckDescription").textbox("setValue", item.qualityCheckDescription);
								$("#lookProjectMilestoneQualityCheckSign").textbox("setValue", item.qualityCheckSign);
								$("#lookProjectMilestoneQualityCheckDate").textbox("setValue", item.qualityCheckDate);
								$("#lookProjectMilestoneQualityCheckInputTime").textbox("setValue", item.qualityCheckInputTime);
								$("#lookProjectMilestoneQualityCheckStatus").textbox("setValue", item.qualityCheckStatus);
								$("#lookProjectMilestoneStatus").textbox("setValue", item.status);
								$("#lookProjectMilestoneRemark").textbox("setValue", item.remark);
								
								$('#lookProjectMilestoneDetail').window('open');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function editProjectMilestoneItem(id){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectMilestone",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								$("#editProjectMilestoneId").val(id);
								$("#editProjectMilestonePlanReviseCount").val(item.planReviseCount);
								$("#editProjectMilestoneStatus").val(item.status);
								$("#editProjectMilestoneName").textbox("setValue", item.name);
								$("#editProjectMilestoneDeliveryDescription").textbox("setValue", item.deliveryDescription);
								$("#editProjectMilestoneFirstPlanFinishDate").textbox("setValue", item.firstPlanFinishDate);
								$("#editProjectMilestonePlanFinishDate").textbox("setValue", item.planFinishDate);
								$("#editProjectMilestoneActualFinishDate").textbox("setValue", item.actualFinishDate);
								$("#editProjectMilestoneAualityCheckDescription").textbox("setValue", item.qualityCheckDescription);
								$("#editProjectMilestoneQualityCheckSign").combobox("setValue", item.qualityCheckSign);
								$("#editProjectMilestoneQualityCheckStatus").textbox("setValue", item.qualityCheckStatus);
								$("#editProjectMilestoneRemark").textbox("setValue", item.remark);
								
								$('#editProjectMilestoneItem').window('open');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function delProjectMilestoneItem(id){
					$.messager.confirm("删除确认", "您确定要删除所选的项目节点吗？", function(r){
						if(r){
							var params = "id=" + id;
							$.ajax({
							  	type: "GET",
							  	url: "delProjectMilestone",
							  	data: params,
							  	success:function(data){
								  	var val = $.parseJSON(data);
									if(val.success){
										bottomRight('提示', '操作成功！');
										$('#projectMilestonedg').datagrid('reload');
										$('#projectMilestonedg').datagrid('reload');
									}else{
										$.messager.alert("提示", val.msg, "error");
									}
							  	}
							});
						}
					});
				}
				$(function(){
					/*******************************************************************************************/
					$("#projectMilestoneForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								bottomRight('提示', '操作成功！');
								$('#addProjectMilestoneItem').window('close');
								$('#projectMilestonedg').datagrid('reload');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					$("#editProjectMilestoneForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								bottomRight('提示', '操作成功！');
								$('#projectMilestonedg').datagrid('reload');						
								$('#editProjectMilestoneItem').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					projectMilestoneSearch();//页面装载完成后加载数据
				});
			</script>
			
		</div>
		
		<div title="项目成员" style="padding: 2px;">
			<table id="projectMemberdg" class="easyui-datagrid" title="项目成员管理"
					data-options="
						rownumbers:true,
						iconCls: 'icon-edit',
						singleSelect: true,
						toolbar: '#projectMembertb',
						singleSelect:true,
						pagination:true,
						fit:true,
						fitColumns:true,
						pageList:[20,25,30,35,40,45,50],
						pageSize:20
					">
				<thead>
					<tr>
						<th data-options="field:'personName',width:80,align:'center'">成员姓名</th>
						<th data-options="field:'projectMemberTypeName',width:40,align:'center'">成员类型</th>
						<th data-options="field:'predictConsumeWorktime',width:40,align:'center'">预计消耗工时</th>
						<th data-options="field:'planEnterDate',width:50,align:'center'">计划介入日期</th>
						<th data-options="field:'planExitDate',width:50,align:'center'">计划退出日期</th>
						<th data-options="field:'duty',width:100,align:'center'">职责</th>
						<th data-options="field:'id',width:60,align:'center',formatter:projectMemberFormatControl">管理</th>
					</tr>
				</thead>
			</table>
		
			<div id="projectMembertb" style="height:auto">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="initProjectMembersWindow()">分配人员</a>
				</div>
				<div>
					成员姓名:
					<select data-options="editable: false" id = "projectMemberPerson" class="easyui-combobox">
						<option value = "-1"> --全部-- </option>
						<c:forEach var="item" items="${projectPersons }" >
							<option value = "${item.id }">${item.name }</option>
						</c:forEach>
					</select>
					项目成员类型名称:
					<select data-options="editable: false" id = "projectMemberProjectMemberType" class="easyui-combobox">
						<option value = "-1"> --全部-- </option>
						<c:forEach var="item" items="${projectMemberTypes }" >
							<option value = "${item.id }">${item.name }</option>
						</c:forEach>
					</select>
					职责: <input class="easyui-textbox" type="text" id="projectMemberDuty" style="width:200px;height:25px;">
					<a href="javascript:projectMemberSearch()" class="easyui-linkbutton" iconCls="icon-search">查 找</a>
				</div>
			</div>
			
			<div id="lookProjectMemberDetail" class="easyui-window" title="项目成员详情" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:700px; height:400px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<table width="100%" height="100%">
							<tr>
								<td width="120px;" align="right">成员姓名：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberPersonId" style="width: 200px;" readonly="readonly" />
								</td>
								<td width="120px;" align="right">项目名称：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberProjectId" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">成员类型名称：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberProjectMemberTypeId" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">创建人：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberCreatePersonId" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">预计消耗工时：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberPredictConsumeWorktime" style="width: 200px;" readonly="readonly" />
								</td>
								
								 <td align="right">实际消耗工时：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberActualConsumeWorktime" style="width: 200px;" readonly="readonly" />
								</td> 
							</tr>
							<tr>
								<td align="right">计划介入项目日期：</td>
								<td>
									<input class="easyui-datebox" id="lookProjectMemberPlanEnterDate" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">计划退出项目日期：</td>
								<td>
									<input class="easyui-datebox" id="lookProjectMemberPlanExitDate" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>								
								<td align="right">项目职责：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberDuty" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">工时系数：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectMemberWorktimeRate" style="width: 200px;" readonly="readonly" />
								</td>
								
							</tr>
							<tr>
								<td align="right">描述：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="multiline:true" style="width: 520px; height: 80px;" id="lookProjectMemberRemark" readonly="readonly" />
								</td>
							</tr>
						</table>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#lookProjectMemberDetail').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="addProjectMemberItem" class="easyui-window" title="新增项目成员" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:660px; height:340px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="addProjectMemberForm" method="post" action="editProjectMember" style="width: 100%; height: 100%">
							<input type="hidden" name="project.id" value="${project.id }" id="addProjectMemberProjectId" />
							<input type="hidden" name="createPerson.id" value="${currentUser.id }" id="addProjectMemberCreatePersonId" />
							<table width="100%" height="100%">
								<tr>
									<td width="100px" align="right">成员类型：</td>
									<td>
										<select data-options="required:true, editable: false" class="easyui-combobox" style="width: 200px" name="projectMemberType.id" >
											<c:forEach items="${projectMemberTypes }" var="item">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
									<td width="100px" align="right">人员姓名：</td>
									<td>
										<select data-options="required:true, editable: false" class="easyui-combobox" style="width: 200px" name="person.id">
											<c:forEach items="${projectMembers }" var="item">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">计划介入日期：</td>
									<td>
										<input class="easyui-datebox" data-options="required:true" style="width: 200px;" name="planEnterDate" />
									</td>
									<td align="right">计划退出日期：</td>
									<td>
										<input class="easyui-datebox" data-options="required:true" style="width: 200px;" name="planExitDate" />
									</td>
								</tr>
								<tr>
									<td align="right">预计消耗工时：</td>
									<td>
										<input class="easyui-numberbox" data-options="required:true, precision: 2" style="width: 200px;" name="predictConsumeWorktime" />
									</td>
									<td align="right">工时系数：</td>
									<td>
										<input class="easyui-numberbox" data-options="required:true, precision: 2" style="width: 200px;" name="worktimeRate" id="addProjectMemberWorktimeRate" value="1" />
									</td>
								</tr>
								<tr>
									<td align="right">职责：</td>
									<td colspan="3">
										<input class="easyui-textbox" style="width: 510px; height: 80px;" data-options="multiline:true" name="duty" />
									</td>
								</tr>
								<tr>
									<td align="right">备注：</td>
									<td colspan="3">
										<input class="easyui-textbox" style="width: 510px; height: 80px;" data-options="multiline:true" name="remark" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#addProjectMemberForm').submit();" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addProjectMemberItem').window('close');" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="editProjectMemberItem" class="easyui-window" title="编辑项目成员" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:660px; height:340px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="editProjectMemberForm" method="post" action="editProjectMember" style="width: 100%; height: 100%">
							<input type="hidden" name="id" id="editProjectMemberId" />
							<input type="hidden" name="project.id" value="${project.id }" id="editProjectMemberProjectId" />
							<input type="hidden" name="createPerson.id" value="${currentUser.id }" id="eidtProjectMemberCreatePersonId" />
							<input type="hidden" name="createTime" id="eidtProjectMemberCreateTime" />
							<table width="100%" height="100%">
								<tr>
									<td width="100px" align="right">成员类型：</td>
									<td>
										<select data-options="required:true, editable: false" class="easyui-combobox" style="width: 200px" name="projectMemberType.id" id="editProjectMemberProjectMemberTypeId" >
											<c:forEach items="${projectMemberTypes }" var="item">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
									<td width="100px" align="right">人员姓名：</td>
									<td>
										<select data-options="required:true, editable: false" class="easyui-combobox" style="width: 200px" name="person.id" id="editProjectMemberPersonId" >
											<c:forEach items="${projectMembers }" var="item">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">计划介入日期：</td>
									<td>
										<input class="easyui-datebox" data-options="required:true" style="width: 200px;" name="planEnterDate" id="editProjectMemberPlanEnterDate" />
									</td>
									<td align="right">计划退出日期：</td>
									<td>
										<input class="easyui-datebox" data-options="required:true" style="width: 200px;" name="planExitDate" id="editProjectMemberPlanExitDate" />
									</td>
								</tr>
								<tr>
									<td align="right">预计消耗工时：</td>
									<td>
										<input class="easyui-numberbox" data-options="required:true, precision: 2" style="width: 200px;" name="predictConsumeWorktime" id="editProjectMemberPredictConsumeWorktime" />
									</td>
									<td align="right">工时系数：</td>
									<td>
										<input class="easyui-numberbox" data-options="required:true, precision: 2" style="width: 200px;" name="worktimeRate" id="editProjectMemberWorktimeRate" />
									</td>
								</tr>
								<tr>
									<td align="right">职责：</td>
									<td colspan="3">
										<input class="easyui-textbox" style="width: 510px; height: 80px;" data-options="multiline:true" name="duty" id="editProjectMemberDuty" />
									</td>
								</tr>
								<tr>
									<td align="right">备注：</td>
									<td colspan="3">
										<input class="easyui-textbox" style="width: 510px; height: 80px;" data-options="multiline:true" name="remark" id="editProjectMemberRemark" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#editProjectMemberForm').submit();" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#editProjectMemberItem').window('close');" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<script type="text/javascript">
				function initProjectMembersWindow(){
					clearForm("addProjectMemberForm", "addProjectMemberItem");
					$('#addProjectMemberProjectId').val('${project.id}');
					$('#addProjectMemberCreatePersonId').val('${currentUser.id}');
					$("#addProjectMemberWorktimeRate").textbox("setValue", 1.0);
				}
				function projectMemberFormatControl(val, row){
					return '<a class="ctl" href="javascript:void(0)" onclick="lookProjectMemberDetail(' + row.id + ')">查看</a>'+
					' <a class="ctl" href="javascript:void(0)" onclick="editProjectMemberItem(' + val + ')">编辑</a>' +
					' <a class="ctl" href="javascript:void(0)" onclick="delProjectMemberItem(' + val + ')">删除</a>';
				}
				function projectMemberSearch(){
					var person = $("#projectMemberPerson").combobox("getValue");
					var projectMemberType = $("#projectMemberProjectMemberType").combobox("getValue");
					var duty = $("#projectMemberDuty").textbox("getValue").trim();
					var url = "queryProjectMember?duty=" + duty + "&personId=" + person + "&projectId=${project.id}&projectMemberTypeId=" + projectMemberType;
					$("#projectMemberdg").datagrid('reload', url);
				}
				function lookProjectMemberDetail(id){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectMember",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								$("#lookProjectMemberPersonId").textbox("setValue", item.personName);
								$("#lookProjectMemberProjectId").textbox("setValue", item.projectName);
								$("#lookProjectMemberCreatePersonId").textbox("setValue", item.createPersonName);
								$("#lookProjectMemberProjectMemberTypeId").textbox("setValue", item.projectMemberTypeName);
								$("#lookProjectMemberPredictConsumeWorktime").textbox("setValue", item.predictConsumeWorktime);
								$("#lookProjectMemberActualConsumeWorktime").textbox("setValue", item.actualConsumeWorktime);
								$("#lookProjectMemberPlanEnterDate").textbox("setValue", item.planEnterDate);
								$("#lookProjectMemberPlanExitDate").textbox("setValue", item.planExitDate);
								$("#lookProjectMemberDuty").textbox("setValue", item.duty);
								$("#lookProjectMemberWorktimeRate").textbox("setValue", item.worktimeRate);
								$("#lookProjectMemberCreateTime").textbox("setValue", item.createTime);
								$("#lookProjectMemberRemark").textbox("setValue", item.remark);
								
								$('#lookProjectMemberDetail').window('open');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function editProjectMemberItem(id){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectMember",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								$("#editProjectMemberId").val(id);
								$("#editProjectMemberProjectId").val(item.projectId);
								$("#eidtProjectMemberCreatePersonId").val(item.createPersonId);
								$("#eidtProjectMemberCreateTime").val(item.createTime);
								
								$("#editProjectMemberProjectMemberTypeId").combobox("setValue", item.projectMemberTypeId);
								$("#editProjectMemberPersonId").combobox("setValue", item.personId);
								$("#editProjectMemberPlanEnterDate").textbox("setValue", item.planEnterDate);
								$("#editProjectMemberPlanExitDate").textbox("setValue", item.planExitDate);
								$("#editProjectMemberPredictConsumeWorktime").textbox("setValue", item.predictConsumeWorktime);
								$("#editProjectMemberWorktimeRate").textbox("setValue", item.worktimeRate);
								$("#editProjectMemberDuty").textbox("setValue", item.duty);
								$("#editProjectMemberRemark").textbox("setValue", item.remark);
								
								$('#editProjectMemberItem').window('open');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function delProjectMemberItem(id){
					$.messager.confirm("删除确认", "您确定要删除所选的项目成员吗？", function(r){
						if(r){
							var params = "id=" + id;
							$.ajax({
							  	type: "GET",
							  	url: "delProjectMember",
							  	data: params,
							  	success:function(data){
								  	var val = $.parseJSON(data);
									if(val.success){
										bottomRight('提示', '操作成功！');
										$('#dg').datagrid('reload');
										$('#projectMemberdg').datagrid('reload');
									}else{
										$.messager.alert("提示", val.msg, "error");
									}
							  	}
							});
						}
					});
				}
				$(function(){
					$("#addProjectMemberForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectMemberdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#addProjectMemberItem').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					$("#editProjectMemberForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectMemberdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#editProjectMemberItem').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					//validateItem
					projectMemberSearch();//页面装载完成后加载数据
				});
			</script>
			
		</div>

		<div title="项目干系人维护" style="padding: 2px;">
			<table id="projectStakeholderdg" class="easyui-datagrid"
				data-options="
							rownumbers:true,
							singleSelect: true,
							toolbar: '#projectStakeholdertb',
							singleSelect:true,
							pagination:true,
							fit:true,
							fitColumns:true,
							pageList:[20,25,30,35,40,45,50],
							pageSize:20
						">
				<thead>
					<tr>
						<th data-options="field:'name',width:80,align:'center'">姓名</th>
						<th data-options="field:'projectStakeholderTypeName',width:80,align:'center'">干系人类型</th>
						<th data-options="field:'department',width:100,align:'center'">部门</th>
						<th data-options="field:'post',width:80,align:'center'">职务</th>
						<th data-options="field:'personalTel',width:60,align:'center'">个人电话</th>
						<th data-options="field:'officeTel',width:60,align:'center'">办公电话</th>
						<th data-options="field:'id',width:80,align:'center',formatter:projectStakeholderFormatControl">管理</th>
					</tr>
				</thead>
			</table>

			<div id="projectStakeholdertb" style="height: auto">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="initShowCommonStakeholderWindow();">新增所级干系人</a>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="initShowProjectStakeholderWindow();">新增事业部干系人</a>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="initShowCustomerStakeholderWindow();">新增客户</a>
				</div>
				<div>
					干系人类别: <select data-options="editable: false" id="projectStakeholderProjectStakeholderType" class="easyui-combobox">
						<option value="-1">--全部--</option>
						<c:forEach var="item" items="${projectStakeholderTypes }">
							<option value="${item.id }">${item.name }</option>
						</c:forEach>
					</select> 干系人姓名: <input class="easyui-textbox" type="text"
						id="projectStakeholderName" style="width: 240px; height: 25px;">
					<a href="javascript:projectStakeholderSearch()"
						class="easyui-linkbutton" iconCls="icon-search">查 找</a>
				</div>
			</div>

			<div id="lookProjectStakeholderDetail" class="easyui-window" title="项目干系人详情" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width: 640px; height: 280px; padding: 5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding: 10px;">
						<table width="100%" height="100%">
							<tr>
								<td width="150px;" align="right">干系人类别：</td>
								<td width="160px">
									<input class="easyui-textbox" id="lookProjectStakeholderProjectStakeholderTypeId" data-options="required:true" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">姓名：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectStakeholderName" data-options="required:true" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">部门：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectStakeholderDepartment" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">职务：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectStakeholderPost" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">个人电话：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectStakeholderPersonalTel" style="width: 200px;" readonly="readonly" />
								</td>
								<td align="right">办公电话：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectStakeholderOfficeTel" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td align="right">描述：</td>
								<td colspan="3">
									<input class="easyui-textbox" data-options="multiline:true" style="width: 480px; height: 80px;" id="lookProjectStakeholderRemark" readonly="readonly" />
								</td>
							</tr>
						</table>
					</div>
					<div data-options="region:'south',border:false"
						style="text-align: right; padding: 5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#lookProjectStakeholderDetail').window('close')" style="width: 80px">关 闭</a>
					</div>
				</div>
			</div>

			<div id="addCommonStakeholderWindow" class="easyui-window" title="新增项目干系人" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width: 640px; height: 260px; padding: 5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding: 10px;">
						<form id="addCommonStakeholderForm" method="post" action="editProjectStakeholder" style="width: 100%; height: 100%">
							<input type="hidden" name="id" id="addCommonStakeholderId" />
							<input type="hidden" name="project.id" id="addCommonStakeholderProjectId" />
							<input type="hidden" name="name" id="addCommonStakeholderPersonName" />
							<table width="100%" height="100%">
								<tr>
									<td width="100px;" align="right">干系人类别：</td>
									<td>
										<select name="projectStakeholderType.id" id="addCommonStakeholderProjectStakeholderTypeId" class="easyui-combobox" style="width: 200px" data-options="required:true, editable: false">
											<option value="2">所计划调度</option>
											<option value="9">所生产调度</option>
											<option value="11">所采购调度</option>
										</select>
									</td>
									<td width="100px;" align="right">姓名：</td>
									<td>
										<select name="personID" id="addCommonStakeholderPersonId" class="easyui-combobox" style="width: 200px" data-options="required:true, editable: false">
											<c:forEach var="item" items="${commonStakeholders }">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">部门：</td>
									<td>
										<input class="easyui-textbox" name="department" id="addCommonStakeholderDepartment" style="width: 200px;" />
									</td>
									<td align="right">职务：</td>
									<td>
										<input class="easyui-textbox" name="post" id="addCommonStakeholderPost" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">个人电话：</td>
									<td>
										<input class="easyui-textbox" name="personalTel" id="addCommonStakeholderPersonalTel" style="width: 200px;" />
									</td>
									<td align="right">办公电话：</td>
									<td>
										<input class="easyui-textbox" name="officeTel" id="addCommonStakeholderOfficeTel" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">描述：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 510px; height: 80px;" name="remark" id="addCommonStakeholderRemark" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#addCommonStakeholderForm').submit()" style="width: 80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addCommonStakeholderWindow').window('close')" style="width: 80px">关 闭</a>
					</div>
				</div>
			</div>

			<div id="addProjectStakeholderWindow" class="easyui-window" title="新增项目干系人" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width: 640px; height: 260px; padding: 5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding: 10px;">
						<form id="addProjectStakeholderForm" method="post" action="editProjectStakeholder" style="width: 100%; height: 100%">
							<input type="hidden" name="id" id="addProjectStakeholderId" />
							<input type="hidden" name="project.id" id="projectStakeholderProjectId" />
							<input type="hidden" name="name" id="addProjectStakeholderName" />
							<table width="100%" height="100%">
								<tr>
									<td width="100px;" align="right">干系人类别：</td>
									<td>
										<select name="projectStakeholderType.id" id="addProjectStakeholderProjectStakeholderTypeId" class="easyui-combobox" style="width: 200px" data-options="required:true, editable: false">
											<option value="13">事业部主管</option>
											<option value="17">事业部计划调度</option>
											<option value="15">事业部质量控制</option>
										</select>
									</td>
									<td width="100px;" align="right">姓名：</td>
									<td>
										<select name="personID" id="addProjectStakeholderPersonId" class="easyui-combobox" style="width: 200px" data-options="required:true, editable: false">
											<c:forEach var="item" items="${projectStakeholderPeoples }">
												<option value="${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<td align="right">部门：</td>
									<td>
										<input class="easyui-textbox" name="department" id="addProjectStakeholderDepartment" style="width: 200px;" />
									</td>
									<td align="right">职务：</td>
									<td>
										<input class="easyui-textbox" name="post" id="addProjectStakeholderPost" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">个人电话：</td>
									<td>
										<input class="easyui-textbox" name="personalTel" id="addProjectStakeholderPersonalTel" style="width: 200px;" />
									</td>
									<td align="right">办公电话：</td>
									<td>
										<input class="easyui-textbox" name="officeTel" id="addProjectStakeholderOfficeTel" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">描述：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 510px; height: 80px;" name="remark" id="addProjectStakeholderRemark" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#addProjectStakeholderForm').submit()" style="width: 80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addProjectStakeholderWindow').window('close')" style="width: 80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="addCustomerStakeholderWindow" class="easyui-window" title="新增项目干系人" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width: 630px; height: 340px; padding: 5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding: 10px;">
						<form id="addCustomerStakeholderForm" method="post" action="editProjectStakeholder" style="width: 100%; height: 100%">
							<input type="hidden" name="id" id="addCustomerStakeholderId" />
							<input type="hidden" name="project.id" id="addCustomerStakeholderProjectId" />
							<input type="hidden" name="projectStakeholderType.id" id="addCustomerStakeholderProjectStakeholderTypeId" />
							<input type="hidden" name="personID" id="addCustomerStakeholderPersonID" />
							<table width="100%" height="100%">
								<tr>
									<td align="right">姓名：</td>
									<td>
										<input class="easyui-textbox" name="name" id="addCustomerStakeholderPersonName" data-options="required:true" style="width: 200px;" />
									</td>
									<td align="right">部门：</td>
									<td>
										<input class="easyui-textbox" name="department" id="addCustomerStakeholderDepartMent" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">个人电话：</td>
									<td>
										<input class="easyui-textbox" name="personalTel" id="addCustomerStakeholderPersonalTel" style="width: 200px;" />
									</td>
									<td align="right">办公电话：</td>
									<td>
										<input class="easyui-textbox" name="officeTel" id="addCustomerStakeholderOfficeTel" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td align="right">职务：</td>
									<td colspan="3">
										<input class="easyui-textbox" name="post" id="addCustomerStakeholderPost" style="width: 500px;" />
									</td>
								</tr>
								<tr>
									<td align="right">描述：</td>
									<td colspan="3">
										<input class="easyui-textbox" data-options="multiline:true" style="width: 500px; height: 120px;" name="remark" id="addCustomerStakeholderRemark" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align: right; padding: 5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#addCustomerStakeholderForm').submit()" style="width: 80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addCustomerStakeholderWindow').window('close')" style="width: 80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<script type="text/javascript">
				function initShowCommonStakeholderWindow(){
					clearForm('addCommonStakeholderForm', 'addCommonStakeholderWindow');
					$('#addCommonStakeholderProjectId').val('${project.id}');
				}
				function initShowProjectStakeholderWindow(){
					clearForm('addProjectStakeholderForm', 'addProjectStakeholderWindow');
					$('#projectStakeholderProjectId').val('${project.id}');
				}
				function initShowCustomerStakeholderWindow(){
					clearForm('addCustomerStakeholderForm', 'addCustomerStakeholderWindow');
					$('#addCustomerStakeholderProjectId').val('${project.id}');
					$('#addCustomerStakeholderProjectStakeholderTypeId').val(18);
				}
				function projectStakeholderFormatControl(val, row){
					var content = '<a class="ctl" href="javascript:void(0)" onclick="lookProjectStakeholderDetail(' + row.id + ')">查看</a>';
					content += ' <a class="ctl" href="javascript:void(0)" onclick="editProjectStakeholderMenu(' + row.id + ', ' + row.projectStakeholderTypeId + ', ' + row.personID + ')">编辑</a>';
					content += ' <a class="ctl" href="javascript:void(0)" onclick="delProjectStakeholderMenu(' + val + ')">删除</a>';
					return content;
				}
				function projectStakeholderSearch(){
					var name = $("#projectStakeholderName").textbox("getValue");
					var projectStakeholderType = $("#projectStakeholderProjectStakeholderType").combobox("getValue");
					var url = "queryProjectStakeholder?name=" + name + "&projectStakeholderTypeId=" + projectStakeholderType + "&projectId=${project.id}";
					$("#projectStakeholderdg").datagrid('reload', url);
				}
				function lookProjectStakeholderDetail(id){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectStakeholder",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								$("#lookProjectStakeholderProjectStakeholderTypeId").textbox("setValue", item.projectStakeholderTypeId);
								$("#lookProjectStakeholderName").textbox("setValue", item.name);
								$("#lookProjectStakeholderDepartment").textbox("setValue", item.department);
								$("#lookProjectStakeholderPost").textbox("setValue", item.post);
								$("#lookProjectStakeholderPersonalTel").textbox("setValue", item.personalTel);
								$("#lookProjectStakeholderOfficeTel").textbox("setValue", item.officeTel);
								$("#lookProjectStakeholderRemark").textbox("setValue", item.remark);
								
								$("#lookProjectStakeholderDetail").window("open");
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function setCommonStakeholderValue(item){
					$("#addCommonStakeholderId").val(item.id);
					$("#addCommonStakeholderProjectId").val(item.projectId);
					$("#addCommonStakeholderPersonName").val(item.name);
					$("#addCommonStakeholderProjectStakeholderTypeId").combobox("setValue", item.projectStakeholderTypeId);
					$("#addCommonStakeholderPersonId").combobox("setValue", item.personID);
					$("#addCommonStakeholderDepartment").textbox("setValue", item.department);
					$("#addCommonStakeholderPost").textbox("setValue", item.post);
					$("#addCommonStakeholderPersonalTel").textbox("setValue", item.personalTel);
					$("#addCommonStakeholderOfficeTel").textbox("setValue", item.officeTel);
					$("#addProjectStakeholderRemark").textbox("setValue", item.remark);
					
					$('#addCommonStakeholderWindow').window('open');
				}
				function setProjectStakeholderValue(item){
					$("#addProjectStakeholderId").val(item.id);
					$("#addProjectStakeholderProjectId").val(item.projectId);
					$("#addProjectStakeholderPersonName").val(item.name);
					$("#addProjectStakeholderProjectStakeholderTypeId").combobox("setValue", item.projectStakeholderTypeId);
					$("#addProjectStakeholderPersonId").combobox("setValue", item.personID);
					$("#addProjectStakeholderDepartment").textbox("setValue", item.department);
					$("#addProjectStakeholderPost").textbox("setValue", item.post);
					$("#addProjectStakeholderPersonalTel").textbox("setValue", item.personalTel);
					$("#addProjectStakeholderOfficeTel").textbox("setValue", item.officeTel);
					$("#addProjectStakeholderRemark").textbox("setValue", item.remark);
					
					$('#addProjectStakeholderWindow').window('open');
				}
				function setCustomerStakeholderValue(item){
					$("#addCustomerStakeholderId").val(item.id);
					$("#addCustomerStakeholderProjectId").val(item.projectId);
					$("#addCustomerStakeholderProjectStakeholderTypeId").val(item.projectStakeholderTypeId);
					$("#addCustomerStakeholderPersonName").textbox("setValue", item.name);
					$("#addCustomerStakeholderDepartment").textbox("setValue", item.department);
					$("#addCustomerStakeholderPost").textbox("setValue", item.post);
					$("#addCustomerStakeholderPersonalTel").textbox("setValue", item.personalTel);
					$("#addCustomerStakeholderOfficeTel").textbox("setValue", item.officeTel);
					$("#addCustomerStakeholderRemark").textbox("setValue", item.remark);
					
					$('#addCustomerStakeholderWindow').window('open');
				}
				function editProjectStakeholderMenu(id, projectStakeholderTypeId, personID){
					var params = "id=" + id;
					$.ajax({
					  	type: "GET",
					  	url: "findProjectStakeholder",
					  	data: params,
					  	success:function(data){
						  	var val = $.parseJSON(data);
							if(val.success){
								var item = val.data;

								if(-1 == personID){
									setCustomerStakeholderValue(item);
								}else{
									if(2 <= projectStakeholderTypeId && 11 >= projectStakeholderTypeId){
										setCommonStakeholderValue(item);
									}else{
										setProjectStakeholderValue(item);
									}
								}
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
					  	}
					});
				}
				function delProjectStakeholderMenu(id){
					$.messager.confirm("删除确认", "您确定要删除所选的项目干系人吗？", function(r){
						if(r){
							var params = "id=" + id;
							$.ajax({
							  	type: "GET",
							  	url: "delProjectStakeholder",
							  	data: params,
							  	success:function(data){
								  	var val = $.parseJSON(data);
									if(val.success){
										bottomRight('提示', '操作成功！');
										$('#projectStakeholderdg').datagrid('reload');
									}else{
										$.messager.alert("提示", val.msg, "error");
									}
							  	}
							});
						}
					});
				}
				$(function(){
					$("#addCommonStakeholderPersonId").combobox({
						onSelect: function(record){
							var params = "id=" + record.value;
							$.ajax({
							  	type: "GET",
							  	url: "findCommonStakeholder",
							  	data: params,
							  	success:function(data){
								  	var val = $.parseJSON(data);
									if(val.success){
										var item = val.data;

										$("#addCommonStakeholderPersonName").val(item.name);
										$("#addCommonStakeholderDepartment").textbox("setValue", item.dept);
										$("#addCommonStakeholderPost").textbox("setValue", item.post);
										$("#addCommonStakeholderPersonalTel").textbox("setValue", item.personalTel);
										$("#addCommonStakeholderOfficeTel").textbox("setValue", item.officeTel);
									}else{
										$.messager.alert("提示", val.msg, "error");
									}
							  	}
							});
						}
					});
					$("#addProjectStakeholderPersonId").combobox({
						onSelect: function(record){
							var params = "id=" + record.value;
							$.ajax({
							  	type: "GET",
							  	url: "findPeople",
							  	data: params,
							  	success:function(data){
								  	var val = $.parseJSON(data);
									if(val.success){
										var item = val.data;

										$("#addProjectStakeholderName").val(item.name);
										$("#addProjectStakeholderDepartment").textbox("setValue", item.departmentName);
										$("#addProjectStakeholderPost").textbox("setValue", item.positionName);
										$("#addProjectStakeholderPersonalTel").textbox("setValue", item.personalTel);
										$("#addProjectStakeholderOfficeTel").textbox("setValue", item.officeTel);
									}else{
										$.messager.alert("提示", val.msg, "error");
									}
							  	}
							});
						}
					});
					$("#addCommonStakeholderForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectStakeholderdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#addCommonStakeholderWindow').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});

					$("#addProjectStakeholderForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectStakeholderdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#addProjectStakeholderWindow').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					$("#addCustomerStakeholderForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectStakeholderdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#addCustomerStakeholderWindow').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					$("#editProjectStakeholderForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectStakeholderdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#editProjectStakeholderMenu').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					//validateMenu
					projectStakeholderSearch();//页面装载完成后加载数据
				});
			</script>
		</div>
		 
		<div title="交付计划" style="padding: 2px;">
			<table id="projectProductdg" class="easyui-datagrid" title="项目产品管理"
				data-options="
					rownumbers:true,
					iconCls: 'icon-edit',
					singleSelect: true,
					toolbar: '#projectProducttb',
					singleSelect:true,
					pagination:true,
					fit:true,
					fitColumns:true,
					pageList:[20,25,30,35,40,45,50],
					pageSize:20
				">
				<thead>
					<tr>
						<th data-options="field:'productName',width:200,align:'center'">产品名称</th>
						<th data-options="field:'batchNo',width:100,align:'center'">批次号</th>
						<th data-options="field:'planDeliveryNumber',width:100,align:'center'">计划交付数量</th>
						<th data-options="field:'actualDeliveryNumber',width:100,align:'center'">已交付数量</th>
						<th data-options="field:'id',width:80,align:'center',formatter:projectProductFormatControl">管理</th>
					</tr>
				</thead>
			</table>
		
			<div id="projectProducttb" style="height:auto">
				<div>
					<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="clearForm('projectProductForm', 'addProjectProductItem');$('#addProjectProductProjectId').val(${project.id });">新增</a>
				</div>
				<div>
					产品名称:
					<select data-options="editable: false" id = "projectProductProduct" class="easyui-combobox">
						<option value = "-1"> --全部-- </option>
						<c:forEach var="item" items="${products }" >
							<option value = "${item.id }">${item.name }</option>
						</c:forEach>
					</select>
					批次号: <input class="easyui-textbox" type="text" id="projectProductBatchNo" style="width:240px;height:25px;">
					<a href="javascript:projectProductSearch()" class="easyui-linkbutton" iconCls="icon-search">查 找</a>
				</div>
			</div>
			
			<div id="lookProjectProductDetail" class="easyui-window" title="项目产品详情" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:630px; height:230px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<table width="100%" height="100%">
							<tr>
								<td width="150px;" align="right">产品名称：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectProductProductName" data-options="required:true" style="width: 200px;" readonly="readonly" />
								</td>
								<td width="120px;" align="right">批次号：</td>
								<td>
									<input class="easyui-textbox" id="lookProjectProductBatchNo" data-options="required:true" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
							<tr>
								<td width="100px;" align="right">计划交付数量：</td>
								<td>
									<input class="easyui-numberbox" id="lookProjectProductPlanDeliveryNumber" style="width: 200px;" readonly="readonly" />
								</td>
								<td width="100px;" align="right">已交付数量：</td>
								<td>
									<input class="easyui-numberbox" id="lookProjectProductActualDeliveryNumber" style="width: 200px;" readonly="readonly" />
								</td>
							</tr>
						</table>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="javascript:$('#lookProjectProductDetail').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="addProjectProductItem" class="easyui-window" title="新增项目产品" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:630px; height:200px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="projectProductForm" method="post" action="editProjectProduct" style = "width:100%; height: 100%">
							<input type="hidden" name="project.id" id="addProjectProductProjectId" />
							<table width="100%" height="100%">
								<tr>
									<td width="150px;" align="right">产品名称：</td>
									<td>
										<select name = "product.id" style="width: 200px;"  class="easyui-combobox" data-options="required:true, editable: false">
											<c:forEach var="item" items="${products }" >
												<option value = "${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
									<td width="100px;" align="right">批次号：</td>
									<td>
										<input class="easyui-textbox" name="batchNo" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td width="100px;" align="right">计划交付数量：</td>
									<td>
										<input class="easyui-numberbox" data-options="precision: 2" data-options="precision: 2" name="planDeliveryNumber" style="width: 200px;" />
									</td>
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#projectProductForm').submit()" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#addProjectProductItem').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<div id="editProjectProductItem" class="easyui-window" title="编辑项目产品" data-options="modal:true,closed:true,iconCls:'icon-search'" style="width:630px; height:200px;padding:5px;">
				<div class="easyui-layout" data-options="fit:true">
					<div data-options="region:'center'" style="padding:10px;">
						<form id="editProjectProductForm" method="post" action="editProjectProduct" style = "width:100%; height: 100%">
							<input type="hidden" id="editProjectProductId" name = "id">
							<input type="hidden" name="project.id" value="${project.id }" />
							<table width="100%" height="100%">
								<tr>
									<td width="150px;" align="right">产品名称：</td>
									<td>
										<select name = "product.id" id="editProjectProductProductId" class="easyui-combobox" data-options="required:true, editable: false" style="width: 200px;">
											<c:forEach var="item" items="${products }" >
												<option value = "${item.id }">${item.name }</option>
											</c:forEach>
										</select>
									</td>
									<td width="100px;" align="right">批次号：</td>
									<td>
										<input class="easyui-textbox" name="batchNo" id="editProjectProductBatchNo" style="width: 200px;" />
									</td>
								</tr>
								<tr>
									<td width="100px;" align="right">计划交付数量：</td>
									<td>
										<input class="easyui-numberbox" data-options="precision: 2" name="planDeliveryNumber" id="editProjectProductPlanDeliveryNumber" style="width: 200px;" />
									</td>
									<!-- <td width="100px;" align="right">实际交付数量：</td>
									<td>
										<input class="easyui-textbox" name="actualDeliveryNumber" id="editProjectProductActualDeliveryNumber" style="width: 150px;" />
									</td> -->
								</tr>
							</table>
						</form>
					</div>
					<div data-options="region:'south',border:false" style="text-align:right;padding:5px 0 0;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="$('#editProjectProductForm').submit()" style="width:80px">确 定</a>
						<a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="javascript:$('#editProjectProductItem').window('close')" style="width:80px">关 闭</a>
					</div>
				</div>
			</div>
			
			<script type="text/javascript">
				function projectProductFormatControl(val, row){
					return '<a class="ctl" href="javascript:void(0)" onclick="lookProjectProductDetail(\'' + row.projectName + '\', \'' + row.productName + '\', \'' + row.batchNo + '\', ' + row.planDeliveryNumber + ', ' + row.actualDeliveryNumber + ')">查看</a>'+
					' <a class="ctl" href="javascript:void(0)" onclick="editProjectProductItem(' + val + ',' + row.projectId + ', ' + row.productId + ', \'' + row.batchNo + '\', ' + row.planDeliveryNumber + ', ' + row.actualDeliveryNumber + ')">编辑</a>'+
					' <a class="ctl" href="javascript:void(0)" onclick="delProjectProductItem(' + val + ')">删除</a>';
				}
				function projectProductSearch(){
					var product = $("#projectProductProduct").combobox("getValue");
					var batchNo = $("#projectProductBatchNo").textbox("getValue").trim();
					var url = "queryProjectProduct?batchNo=" + batchNo + "&projectId=${project.id}&productId=" + product;
					$("#projectProductdg").datagrid('reload', url);
				}
				function lookProjectProductDetail(projectName, productName, batchNo, planDeliveryNumber, actualDeliveryNumber){
					$("#lookProjectProductProductName").textbox("setValue", productName);
					$("#lookProjectProductBatchNo").textbox("setValue", batchNo);
					$("#lookProjectProductPlanDeliveryNumber").textbox("setValue", planDeliveryNumber);
					$("#lookProjectProductActualDeliveryNumber").textbox("setValue", actualDeliveryNumber);
					
					$('#lookProjectProductDetail').window('open');
				}
				function editProjectProductItem(id, projectId, productId, batchNo, planDeliveryNumber, actualDeliveryNumber){
					$("#editProjectProductId").val(id);
					$("#editProjectProductProjectId").combobox("setValue", projectId);
					$("#editProjectProductProductId").combobox("setValue", productId);
					$("#editProjectProductBatchNo").textbox("setValue", batchNo);
					$("#editProjectProductPlanDeliveryNumber").textbox("setValue", planDeliveryNumber);
					$("#editProjectProductActualDeliveryNumber").textbox("setValue", actualDeliveryNumber);
					
					$('#editProjectProductItem').window('open');
				}
				function delProjectProductItem(id){
					$.messager.confirm("删除确认", "您确定要删除所选的项目产品吗？", function(r){
						if(r){
							var params = "id=" + id;
							$.ajax({
							  type: "GET",
							  url: "delProjectProduct",
							  data: params,
							  success:function(data){
								var val = $.parseJSON(data);
								if(val.success){
									bottomRight('提示', '操作成功！');
									$('#projectProductdg').datagrid('reload');
								}else{
									$.messager.alert("提示", val.msg, "error");
								}
							  }
							});
						}
					});
				}
				$(function(){
					$("#projectProductForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								bottomRight('提示', '操作成功！');
								$('#addProjectProductItem').window('close');
								$('#projectProductdg').datagrid('reload');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					$("#editProjectProductForm").form({
						onSubmit: function(){
							var isValid = $(this).form('validate');
							return isValid;	// 返回false将停止form提交 
					    },
						success:function(data){
							var val = $.parseJSON(data);
							if(val.success){
								$('#projectProductdg').datagrid('reload');
								bottomRight('提示', '操作成功！');
								$('#editProjectProductItem').window('close');
							}else{
								$.messager.alert("提示", val.msg, "error");
							}
						}
					});
					projectProductSearch();
				});
			</script>
	
		</div>
	</div>
</body>
</html>